//
//  HomeButtonTableViewCell.m
//  TestApplication
//
//  Created by Hanlingyu on 16/9/5.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "HomeButtonTableViewCell.h"
#import "NewActionChannel.h"
#import "NewActionContent.h"
@interface HomeButtonTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *channelLabel;
@property (weak, nonatomic) IBOutlet UIButton *likeButton;

@property (weak, nonatomic) IBOutlet UIButton *moreButton;
@property (weak, nonatomic) IBOutlet UILabel *commentNumLabel;
@property (weak, nonatomic) IBOutlet UIButton *commentButton;
@property (weak, nonatomic) IBOutlet UILabel *likedNumLabel;

@end


@implementation HomeButtonTableViewCell

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    self = [super initWithCoder:aDecoder];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor colorWithWhite:0.917 alpha:1.000];
        
    }
    return self;
}

- (void)setActionContent:(NewActionContent *)actionContent {
    
    _actionContent = actionContent;
// 点赞个数
    if (_actionContent.likeNum) {
        _likedNumLabel.text = [NSString stringWithFormat:@"%ld", _actionContent.likeNum];
    } else {
        _likedNumLabel.text = nil;
    }
// 留言个数
    if (_actionContent.commentNum) {
        _commentNumLabel.text = [NSString stringWithFormat:@"%ld", _actionContent.commentNum];
    } else {
        _commentNumLabel.text = nil;
    }
// 来源频道
    _channelLabel.text = _actionContent.channel.content;
// 点赞按钮的图片赋值
    if (_actionContent.isLiked == 1) {
        [_likeButton setImage:[UIImage imageNamed:@"liked"] forState: UIControlStateNormal];
    } else {
        [_likeButton setImage:[UIImage imageNamed:@"heart"] forState: UIControlStateNormal];
    }
}

- (void)layoutSubviews{
    [super layoutSubviews];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
